﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Exhibition.Dao.ViewModel;
using Exhibition.Service;

namespace Exhibition.UserCenter
{
    public partial class SignUp : BaseUserPage
    {
        StringBuilder sb = new StringBuilder();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                GetProduct();

                GetUserData();
               
            }
        }

        private void GetProduct()
        {
            List<ProductClassModel> pmdls = CenterService.productClassService.GetListByPid(stmd.Id);
            foreach (var p in pmdls) {
                sb.AppendFormat("<span class=\"mr\"><input type=\"checkbox\" value=\"{0}\" name='chkClass' /> {1}</span>", p.Id, p.ClassName);
            
            }
            ltrProduct.Text = sb.ToString();


        }

        private void GetUserData()
        {
            if (LoginUser != null)
            {
                Email.Text = LoginUser.Email;
                Position.Text = LoginUser.Position;
                Mobile.Text = LoginUser.Mobile;
                if (LoginUser.compMdl != null)
                {
                    ltrCompName.Text = LoginUser.compMdl.CompName;
                    ltrCompAddr.Text = LoginUser.compMdl.CompAddr;
                    ContactMan.Text = LoginUser.compMdl.Contact;
                    Phone.Text = LoginUser.compMdl.PhoneStart + "-" + LoginUser.compMdl.PhoneNum;
                    Fax.Text = LoginUser.compMdl.FaxStart + "-" + LoginUser.compMdl.FaxNum;
                }
            }
        }
    }
}